<%@ page contentType="text/html;charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@include file="./common/base.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>有而就是有范儿</title>
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
</head>

<body>
<div class="outer-wrapper  noimgbg">
	<%@ include  file="./common/header.jsp"%>
	<div id="hiDataListId" style="min-height:1200px;">
    </div>
   <%@ include  file="./common/footer.jsp"%>
    <!--footer end -->
</div>
<!-- Snake Change 20141209 -->
<div class="mailBG"></div>
<div class="mailContent">
	<div style="height: 40px;line-height: 40px;background-color: #f15a24;text-align: center;color: white;font-size: 16px;">
		发送邮件
		<div style="cursor: pointer;position: absolute;left: 480px;top: 11px;">
			<img src="image/mailClose.png" alt="close" title="关闭" class="mailClose" />
		</div>
	</div>
	<div style="height: 200px;margin-top: 25px;">
		<div style="float: left;font-size: 16px;margin: 0 20px;">内容</div><textarea id="mailContentHIId" style="width: 400px;height: 200px;border-color: #b2b2b2" rows="0" cols="0"></textarea>
	</div>
	<div style="margin: 0 auto;width: 165px;margin-top: 20px;">
		<div style="width: 180px;height: 35px;line-height: 35px;text-align: center;background-color: #f15a24;color: white;font-size: 16px;cursor: pointer;" onclick="sendMailByHi();">
			发送
		</div>
	</div>
</div>
<!-- Snake Change 20141209 -->
</body>
<script>
var pageIndex=0;
$(function() { 
	if(!checkLogin()){
		return;
	}
	getMyHi(pageIndex);
});

var hasHI=false;
var hiCardId=0;
function setCardHiId(cardId) {
	hiCardId=cardId;
}
function sendMailByHi() {
	var cardId = hiCardId;
	var title="来自youoor的邮件";
	var contentDiv = $("#mailContentHIId");
	var content =contentDiv.val();
	if(content==null||content=="") {
		alert("发送内容不能为空");return;
	}
	sendMailByYouoor(cardId,title,content);
	$('.mailBG').fadeOut(800);
	$('.mailContent').fadeOut(800);
	contentDiv.val("");
}
function formatHiData(hiDataList) {
	var hiDiv = $("#hiDataListId");
	if(hiDataList) {
		if(hiDataList.length>0) {
			hiDiv.empty();
			hasHI=true;
			for (var k=0;k<hiDataList.length;k++) {
				var randomId=generateMixed(9);
				hiDiv.append("<div class=\"content-7 clear\">"+
						        "<div class=\"user-img-7 fl\" >"+
						           "<img  class=\"divImg\" onclick=\"toViewCard("+hiDataList[k].userCard.cardId+")\" alt=\"head\" src=\""+imgDomain+hiDataList[k].userCard.background+"\"/>"+
						        "</div>"+
						      "<div class=\"fl\">"+
						         "<div class=\"userinfo-title-7\">"+
						            "<div class=\"fl\">"+hiDataList[k].userCard.name+"</div>"+
					                "<div class=\"userinfo-title-7-right fr\" style=\"padding-right: 20px;\">"+hiDataList[k].hiCtime+"</div>"+
					                "<div class=\"clear\"></div>"+
					                "<hr />"+
					                "<div class=\"userinfo-content-7 fl\"><img src=\"image/icon-add1.png\" class=\"fl\" /></div>"+
					            	"<div class=\"userinfo-content-7 fl\">"+hiDataList[k].content+"</div>"+
					            	"<ul class=\"widget clear\">"+
							        	"<li id=\""+randomId+"\" class=\"share-op-li share-op-li-s-7 share-op-li-c"+hiDataList[k].userCard.styleInt+"\"  onMouseOver='onMouseOverShare(\""+randomId+"\",\""+hiDataList[k].userCard.cardId+"\",\""+hiDataList[k].userCard.background+"\");' onMouseOut='onMouseOutShare(\""+randomId+"\");'>"+
							            	"<a href=\"javascript:void(0);\" class=\"share-op share-op"+hiDataList[k].userCard.styleInt+" \"    >2</a>"+
							            	"<div class=\"bg-long bg-long-c"+hiDataList[k].userCard.styleInt+"\"  style=\"display:none;\"  >"+
							                    "<p>分享到：</p>"+
							                    "<ul class=\"share-pop-in\">"+
								                    "<li><a href=\"javascript:void(0);\" class=\"pop-sina\" onclick=\"javascript:bShare.share(event,'sinaminiblog',0);\">新浪网</a></li>"+
						                            "<li><a href=\"javascript:void(0);\" class=\"pop-tengxun\" onclick=\"javascript:bShare.share(event,'qqmb',0);\">腾讯</a></li>"+
						                            "<li><a href=\"javascript:void(0);\" class=\"pop-happy\" onclick=\"javascript:bShare.share(event,'kaixin001',0);\" >开心网</a></li>"+
						                            "<li><a href=\"javascript:void(0);\" class=\"pop-douban\" onclick=\"javascript:bShare.share(event,'douban',0);\">豆瓣</a></li>"+
							                    "</ul>"+
							                   // "<div class=\"wsp-in wspc1\">"+
							                    //"<img alt=\"微信二维码\" src=\"image/icon-code-2.png\" />"+
							                    //"</div>"+
							                "</div>"+                	
							            "</li>"+
							            "<li class=\"share-op-li share-op-li-s-7 share-op-li-c"+hiDataList[k].userCard.styleInt+"\"><a href=\"javascript:favoCard("+hiDataList[k].userCard.cardId+")\" class=\"add add"+hiDataList[k].userCard.styleInt+"\">11</a></li>"+
							            "<li class=\"share-op-li share-op-li-s-7 share-op-li-c"+hiDataList[k].userCard.styleInt+"\"><a href=\"javascript:hi("+hiDataList[k].userCard.cardId+")\" class=\"say-hi say-hi"+hiDataList[k].userCard.styleInt+"\">22</a></li>"+
							            "<li class=\"share-op-li share-op-li-s-7 share-op-li-c"+hiDataList[k].userCard.styleInt+"\"><a href=\"javascript:setCardHiId("+hiDataList[k].userCard.cardId+")\" class=\"send-msg send-msg"+hiDataList[k].userCard.styleInt+" mail\">33</a></li>"+
							            
							        "</ul>"+
							        "</div>"+
							    "</div>"+
							"</div>");
						            
			}
			hiDiv.append("<div style=\"text-align: center;padding-top: 30px;\">"+
					"<a href=\"javascript:previewPage();\" title=\"上一页\"><img style=\"vertical-align: text-top;\" src=\"image/icon_prev.png\" alt=\"\" />上一页</a>"+
					"&nbsp;&nbsp;&nbsp;&nbsp;"+
					"<a href=\"javascript:nextPage();\" title=\"下一页\">下一页<img style=\"vertical-align: text-top;\" src=\"image/icon_next.png\" alt=\"\" /></a>"+
				"</div>");
		}else {
			hasHI=false;
			pageIndex =pageIndex-1;
			/*if(pageIndex==0||pageIndex==-1) {
				hiDiv.empty();
				hiDiv.append("<img src=\"image/nohi.png\" style=\" clear:both;display: block;margin:20px auto;width: 680px;\"/>");
			}*/
			
		}
		


		
	
	}
}



$(window).load(function() { 
	//resImg();
	}); 

/**
 * 上一页
 */
function previewPage() {
	if (pageIndex==0) {
		alert("到头了");return;
	}
	pageIndex = pageIndex-1;
	getMyHi(pageIndex);
}

/**
 * 下一页
 */
function nextPage() {
	if(hasHI) {
		pageIndex=pageIndex+1
		getMyHi(pageIndex);
	}else {
		alert("到头了");
	}
}

/**
 * 我的收藏的
 */
function getMyHi(pageIndex) {
	objp= {}
	objp.pageIndex = pageIndex;
	objp.num = 5
	   $.ajax({
			  url: '${path}/core/getMyHi',
			  type: 'POST',
			  timeout: 30000,
			  cache : false,
		      data :objp,
		      async: false,
			  success:function(msg){
				  formatHiData(msg.hiList);
			   },
			   failure:function(msg){
				   alert(eval('('+msg.responseText+')').error_text);
			   		
			   },
			   error:function(msg){
				   alert(eval('('+msg.responseText+')').error_text); 
			   }
		});
}
</script>
<script type="text/javascript" src="js/js.js"></script>
</html>
